package 力扣.比赛;

public class 所有数对按位与结果的异或和1835 {
    /**
     * 超时
     * @param arr1
     * @param arr2
     * @return
     */
    public int getXORSum(int[] arr1, int[] arr2) {
         if (arr1 == null || arr2 == null){
             return 0;
         }
         int len1 = arr1.length;
         int len2 = arr2.length;
         int len = len1 * len2;
         int[] p = new int[len];
         int pos = 0;
        for (int i = 0; i < len1; i++) {
            for (int j = 0; j < len2; j++) {
                p[pos++] = arr1[i] & arr2[j];
            }
        }
        int ans = p[0];
        for (int i = 1; i < len; i++) {
            ans ^= p[i];
        }
        return ans;
    }
}
